# Maintainer: Forest Crossman <cyrozap at gmail dot com>

pkgname=stp
pkgver=2.3.3
pkgrel=9
pkgdesc="Simple Theorem Prover"
arch=('i686' 'loong64' 'x86_64')
url="https://stp.github.io/"
license=('MIT')
depends=('boost-libs' 'cryptominisat5' 'minisat')
makedepends=('boost' 'cmake' 'help2man' 'ninja' 'python')
source=("https://github.com/$pkgname/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        'mandir.patch')
sha256sums=('ea6115c0fc11312c797a4b7c4db8734afcfce4908d078f386616189e01b4fffa'
            '4c09301c5a36cd89845a7177e1215008f8bbb23fa6f3c6cc941006825e28c327')

prepare() {
  # Correct the destination for man documentation.
  patch -d $pkgname-$pkgver < mandir.patch
  mkdir -p build

  # Remove RPATH
  sed -i '/RPATH/d' $pkgname-$pkgver/{,tools/stp/,tools/stp_simple/}CMakeLists.txt
}

build() {
  cd build
  cmake \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DENABLE_PYTHON_INTERFACE=ON \
    ../$pkgname-$pkgver
  ninja
}

package() {
  cd $pkgname-$pkgver
  install -Dm644 LICENSE LICENSE_COMPONENTS -t "$pkgdir"/usr/share/licenses/$pkgname/

  cd ../build
  DESTDIR="$pkgdir" ninja install
}

# vim:set ts=2 sw=2 et:
